import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
//这里原来是路由的代码
import {constantRoutes} from './routes';
//创建路由器对象函数
const createRouter = () => new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})
//实例化路由器
const router = createRouter()

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
//重置路由去函数
export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}
//暴露路由器对象===router
export default router
